package org.example.service;

import org.example.api.IUserService;
import org.example.api.entity.User;
import org.example.api.utils.DruidConnectionUtils;
import org.example.dao.IUserDao;
import org.example.dao.impl.UserDaoImpl;

import java.util.List;

/**
 * @Author: Re
 * @Date: 2021/4/17 23:18
 */
public class UserServiceImpl implements IUserService {
    DruidConnectionUtils druidConnectionUtils = new DruidConnectionUtils();
    IUserDao iUserDao = new UserDaoImpl();
    @Override
    public boolean addUser(User user) {
        return iUserDao.addUser(druidConnectionUtils.getConnection(),user);
    }

    @Override
    public User checkUser(User user) {
        return iUserDao.checkUser(druidConnectionUtils.getConnection(),user);
    }

    @Override
    public boolean deleteUser(User user) {
        return iUserDao.deleteUser(druidConnectionUtils.getConnection(), user);
    }

    @Override
    public boolean updateUser(User user) {
        return iUserDao.updateUser(druidConnectionUtils.getConnection(), user);
    }

    @Override
    public List<User> checkAllUser() {
        return iUserDao.checkAllUser(druidConnectionUtils.getConnection());
    }
}
